<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="probiz" tagdir="/WEB-INF/tags/probiz"%>
<%@ taglib prefix="other" tagdir="/WEB-INF/tags/other"%>
<probiz:pageHeading pageHeadingKey="productList.heading" />
<head>
	<c:if test="${not empty param.direct}">
		<c:set var="hideMainDiv" value="true" scope="request"/>
	</c:if>
</head>

<content tag="buttons">
	<div class="line"></div>
	<authorize:authorizeResource resourceString="/product/prod.html?direct=add*">
		<probiz:iconBtn btnType="addProduct" onclick="createProduct();" />
	</authorize:authorizeResource>
	<authorize:authorizeResource resourceString="/product/prod.html?doAction=*Delete*">
		<probiz:iconBtn btnType="delete" id="multiDelete" onclick="deleteProducts();" />
	</authorize:authorizeResource>
	<div class="line"></div>
	<authorize:authorizeResource resourceString="/product/prod*doAction=*helve*">
		<probiz:iconBtn btnType="multiShelve" onclick="multiShelveProducts();" />
		<probiz:iconBtn btnType="multiOffShelve" onclick="multiOffShelveProducts();" />
	</authorize:authorizeResource>	
	<authorize:authorizeResource resourceString="/product/prod/*.html?doAction=*ave*">
		<probiz:iconBtn btnType="unitiveBulkedit" onclick="unitiveBulkEdit();" />
	</authorize:authorizeResource>
	<div class="line"></div>
	<%--<probiz:iconBtn btnType="export" onclick="dlgTemplateEditor_show();" />--%>
	<authorize:authorizeResource resourceString="/tool/productExport/dialog.html?doAction=outputExcel*">
		<probiz:iconBtn btnType="export" onclick="outExcel();" />
	</authorize:authorizeResource>
	<authorize:authorizeResource resourceString="/tool/productImport.html*">
		<probiz:iconBtn btnType="import" url="${ctxPath}/tool/productImport.html" />
	</authorize:authorizeResource>
</content>
<verFunc:verFuncValidate funcKey="tag">
<content tag="tags">
	<authorize:authorizeResource resourceString="/product/prod/*.html?doAction=*ave*">
		<other:tagSelector selectorId="tagSelector" module="1" left="-25" applyCallbackFunc="applyTags" manageCallbackFunc="manageTags"/>
	</authorize:authorizeResource>
</content>
</verFunc:verFuncValidate>
<div id="productList">
	<%@include file="include/productSearchCriteria.jspf"%>
	
		<div class="tree">
			<div class="tree_wrap">
				<div class="hd"></div>
					<div class="content" id="categoryTree">
						<%@ include file="../catalog/include/productCategoryTreeBody.jspf"%>
					</div>
				<div class="ft"></div>
			</div>
		</div>
		<div class="tree_r">
			<div id="productResults" name="productResults" class="tree_r_wrap">
				<%--ajaxLoad file="/product/include/productListBody.jsp" --%>
			</div>
		</div>
</div>

<%-----productForm的div在装饰器中----%>

<%-----start:list需要加载的JS ----%>
<c:set var="plugin_tree" value="true" scope="request"/>
<c:set var="plugin_inFieldLabel" value="true" scope="request"/>
<script type="text/javascript"	src="${ctxPath}/scripts/probiz/product/productListForTags.js?rs=${appConfig.rs}"></script>
<script type="text/javascript"	src="${ctxPath}/scripts/probiz/product/productList.js?rs=${appConfig.rs}"></script>
<%-----end:  list需要加载的JS ----%>

<%-----start:form需要加载的JS ----%>
<c:set var="plugin_upload" value="true" scope="request"/>
<c:set var="plugin_newUpload" value="true" scope="request"/>
<c:set var="plugin_htmlEditor" value="true" scope="request"/>
<c:set var="ui_dialog" value="true" scope="request"/>
<c:set var="ui_accordion" value="true" scope="request"/>
<c:set var="ui_tabs" value="true" scope="request"/>
<c:set var="ui_sortable_js" value="true" scope="request"/>
<c:set var="ui_datepicker" value="true" scope="request"/>
<script type="text/javascript"	src="${ctxPath}/scripts/probiz/product/productForm.js?rs=${appConfig.rs}"></script>
<%-----end:  form需要加载的JS ----%>

<script type="text/javascript">
$j(document).ready(function () {
	__FMTExtend = {
		form_select_all:"<fmt:message key="common.message.select.all"/>",
		productList_selectProduct:"<fmt:message key="productList.selectProduct"/>",
		product_label:"<fmt:message key="product.label"/>",
		product_delete_false:"<fmt:message key="product.delete.false"/>",
	    product_delete_success:"<fmt:message key="product.delete.success"/>",
	    product_delete_logical:"<fmt:message key="product.delete.logical"/>",
	    productList_message_confirmShelveThis:"<fmt:message key="productList.message.confirmShelveThis"/>",
		productList_message_confirmShelveThis_success:"<fmt:message key="productList.message.confirmShelveThis.success"/>",
		productList_message_confirmOffShelveThis:"<fmt:message key="productList.message.confirmOffShelveThis"/>",
		productList_message_confirmOffShelveThis_success:"<fmt:message key="productList.message.confirmOffShelveThis.success"/>",
		productList_message_confirmDeleteThisSuffix:"<fmt:message key="productList.message.confirmDeleteThisSuffix"/>",
	
		productForm_deleteAllImage_confirm:"<fmt:message key="productForm.deleteAllImage.confirm"/>",
		productForm_media_title_tip:"<fmt:message key="productForm.media.title.tip"/>",
		productForm_stepLast:"<fmt:message key="productForm.stepLast"/>",
		productForm_signNotNegativeNum:"<fmt:message key="productForm.signNotNegativeNum"/>",
		productForm_signLastMaxQuantity:"<fmt:message key="productForm.signLastMaxQuantity"/>",
		productForm_saveProduct_success:"<fmt:message key="productForm.saveProduct.success"/>",
		productForm_waitImagesLoaded:"<fmt:message key="productForm.waitImagesLoaded"/>",
		productForm_waitSkusLoaded:"<fmt:message key="productForm.waitSkusLoaded"/>",
		productForm_waitAttributesLoaded:"<fmt:message key="productForm.waitAttributesLoaded"/>",
		productForm_waitRecommendsLoaded:"<fmt:message key="productForm.waitRecommendsLoaded"/>",
		productForm_basicPrice:"<fmt:message key="productForm.basicPrice"/>",
		productForm_wholesalePrice:"<fmt:message key="productForm.wholesalePrice"/>",
		productForm_skuOptionDisable:"<fmt:message key="productForm.skuOptionDisable"/>",
		productForm_skuOptionAtLeastOne:"<fmt:message key="productForm.skuOptionAtLeastOne"/>",
		productForm_skuOptionCannotOpen:"<fmt:message key="productForm.skuOptionCannotOpen"/>",
		productForm_selectOptionValueAtLeast:"<fmt:message key="productForm.selectOptionValueAtLeast"/>",
		productForm_noOptionalSkuOptionValue1:"<fmt:message key="productForm.noOptionalSkuOptionValue1"/>",
		productForm_noOptionalSkuOptionValue2:"<fmt:message key="productForm.noOptionalSkuOptionValue2"/>",
		productForm_noOptionalSkuOptionValue3:"<fmt:message key="productForm.noOptionalSkuOptionValue3"/>",
		productForm_confirmDefineAction:"<fmt:message key="productForm.confirmDefineAction"/>",
		productForm_skuIsInUse:"<fmt:message key="productForm.skuIsInUse"/>",
		productForm_noOpenSkuOption_confirm:"<fmt:message key="productForm.noOpenSkuOption.confirm"/>",
		productForm_adddRecommended_noRepeat:"<fmt:message key="productForm.adddRecommended.noRepeat"/>",
		productForm_adddRecommended_noSelf:"<fmt:message key="productForm.adddRecommended.noSelf"/>",
		productForm_adddPackageItem_noRepeat:"<fmt:message key="productForm.adddPackageItem.noRepeat"/>",
		productForm_adddPackageItem_noSelf:"<fmt:message key="productForm.adddPackageItem.noSelf"/>",
		productForm_adddPackageItem_noPackage:"<fmt:message key="productForm.adddPackageItem.noPackage"/>",
		productForm_incorrectMaxQuantity:"<fmt:message key="productForm.incorrectMaxQuantity"/>",
		
		productSku_listPrice:"<fmt:message key="productSku.listPrice"/>",
		productSku_price:"<fmt:message key="productSku.price"/>",
		productSku_salePrice:"<fmt:message key="productSku.salePrice"/>",
		productSku_weight:"<fmt:message key="productSku.weight"/>",
		productSku_inventory:"<fmt:message key="productSku.inventory"/>",
		productSku_image_tip:"<fmt:message key="productSku.image.tip"/>",
		productSku_productSkuCode:"<fmt:message key="productSku.productSkuCode"/>",
		
		product_imageUrl_tip:"<fmt:message key="product.imageUrl.tip"/>",
		product_delete_false:"<fmt:message key="product.delete.false"/>",
	    product_delete_success:"<fmt:message key="product.delete.success"/>",
	    product_delete_logical:"<fmt:message key="product.delete.logical"/>",
	    
	    wholesalePrice_price:"<fmt:message key="wholesalePrice.price"/>",
		wholesalePrice_minQuantity:"<fmt:message key="wholesalePrice.minQuantity"/>",
		wholesalePrice_maxQuantity:"<fmt:message key="wholesalePrice.maxQuantity"/>",
		wholesalePrice_delete:"<fmt:message key="wholesalePrice.delete"/>",
		
		productDetail_package_productSkuCode:"<fmt:message key="productDetail.package.productSkuCode"/>",
    	productDetail_package_quantity:"<fmt:message key="productDetail.package.quantity"/>",
    	productDetail_recommendResult_none:"<fmt:message key="productDetail.recommendResult.none"/>",
    	productDetail_recommendResult_saveFirst:"<fmt:message key="productDetail.recommendResult.saveFirst"/>"
    	
	};
	$j.extend(__FMT, __FMTExtend); 		
});

$j(document).ready(function () {
	searchProducts(true,'');
	jCategoryTree = $j('#categoryTree > ul').simpleTree({
		drag:false,
		afterClick:function(node){
			clickTreeItemAction();
		},
		afterDblClick:function(node){
		},
		afterMove:function(destination, source, pos){
		},
		afterAjax:function()
		{
		},
		animate:true
		//,docToFolderConvert:true
	})[0];
	$j("#categoryTree").show();
	
	<c:if test="${(not empty param.direct) and (param.direct == 'add')}">
		createProduct();
	</c:if>
	
	<c:if test="${not empty param.productId}">
		editProduct(${param.productId});
	</c:if>
	//输入框文字说明效果
	$j('.inFieldLabel label').inFieldLabels({fadeOpacity: 0.3});
	
});
function fnSaveTemplateContent(){
	
}
function outExcel(){
	var paraData=$j("#productListForm :input[name='multiIds']").serialize();
	window.location = "${ctxPath}/tool/productExport/dialog.html?doAction=outputExcel&" + paraData;
}
</script>
<%--<c:set var="ui_dialog" value="true" scope="request"/>
<fmt:message key="button.save" var="buttonSave"/>
<probiz:ui_dialog id="TemplateEditor" title="导出设置" width="500" height="300" buttons="'${buttonSave}':fnSaveTemplateContent" url="${ctxPath}/tool/productExport/dialog.html">
	
</probiz:ui_dialog>--%>